<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>六西格玛知识管理</title>
<link href="<?php echo $this->baseUrl ?>/public/style/style.css" rel="stylesheet" type="text/css">
<link href="<?php echo $this->baseUrl;?>/public/style/daterangepicker.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->baseUrl;?>/public/style/jquery-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/daterangepicker.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/jquery-ui.js"></script>
</head>
<style>
.delete,.edit,.add{color: blue;cursor: pointer;}
</style>
<script>
$(document).ready(function(){
//添加字段
 $(".add").click(function(){
		 var model = $("#model").val();
		 var column_name = $("#column_name").val();
		 var column_comment = $("#column_comment").val();
		 var str = "model="+model+"&column_name="+column_name+"&column_comment="+column_comment;
			$.ajax({
		   type: "POST",
		   url: "<?php echo $this->baseUrl;?>/excel/add",
		   data: str,
		   success: function(msg){
			 alert(msg);
				 window.location.reload();
		   }
		});
 })

//修改字段
 $(".edit").click(function(){
		 var column_name = $(this).parents("li").parents("ul").children().children(".column_name").html();
		 var column_comment = $(this).parents("li").parents("ul").children().children(".column_comment").html();
		 var model = $("#model").val();
		 var url = "<?php echo $this->baseUrl;?>/excel/edit?model="+model+"&column_name="+column_name+"&column_comment="+column_comment;
		 window.location=url;
 })
//删除表字段
 $(".delete").click(function(){
	 var column_name = $(this).parents("li").parents("ul").children().children(".column_name").html();
	 var model = $("#model").val();
	 var str = "model="+model+"&column_name="+column_name;
		  $.ajax({
		   type: "POST",
		   url: "<?php echo $this->baseUrl;?>/excel/delete",
		   data: str,
		   success: function(msg){
			 alert(msg);
				 window.location.reload();
		   }
		});
 })
})
</script>
<body>
<!--头部-->
<?php echo $this->partial('common/header.html', array('template'=>$this->template, 'baseUrl'=>$this->baseUrl)) ?>

<!--主体-->
<div class="main-box" id="mainBox">
    <div class="third-menu">
        <?php echo $this->partial('common/operation.html', array('template'=>$this->template, 'baseUrl'=>$this->baseUrl)) ?>
        <div class="menu-title"><span class="icon"></span>批量添加管理</div>
    </div>
    <div class="separate-line"></div>
  
	<div class="main-form" style="margin-bottom:10px;">
		<input type="hidden" name="model" value="<?php echo $this->model;?>" id="model" />
    	<div style="padding-left:148px; font-size:16px; font-weight:600;">字段名=>字段名注释</div>
        <?php foreach($this->fields as $field){?>
        <ul style="padding-left:148px;">
    		<li style="float:left; width:100px;"><span class="column_name" style="width:100px;"><?php echo $field['COLUMN_NAME']?></span></li>
            <li style="float:left; width:140px;">=><span class="column_comment" style="padding-left:20px;"><?php echo $field['COLUMN_COMMENT']?></span></li>
            <li><span class="edit">修改</span><span class="delete" style="padding-left:10px;">删除</span></li>
    	</ul>
        <?php }?>
        <p>
            <label>字段名:</label>
            <input type="text" name="column_name" id="column_name" class="input-text" />
        </p>
        <p>
            <label>注释:</label>
            <input type="text" name="column_comment" id="column_comment" class="input-text" />
        </p>
        <p><label>&nbsp;</label><input type="button" class="add button" style="margin-left:0" value="增加字段" /></p>
        <form action="<?php echo $this->baseUrl;?>/excel/upload" method="post" enctype="multipart/form-data" />
        <input type="hidden" name="model" value="<?php echo $this->model;?>" id="model" />
		<p>	
            <label>&nbsp;</label>
            <input type="file" name="files" />
            <input type="submit" class="button" value="批量上传" />
		</p>
        </form>
	</div>
</div>
<!--底部-->
<?php echo $this->partial('common/footer.html') ?>
</body>
</html>
